import java.io.*;

public class MyByteReader {
    public static void main(String[] args) {
        File file = new File(args[0]);
        File out_file = new File("C:/Users/Bobby's/Desktop/test_out.txt");
        int oneByte, i = 0;
        byte[] bArray = new byte[1024];
        
        try {
            if(out_file.exists()) {
                out_file.delete();
                out_file.createNewFile();
            }
            FileInputStream dis = new FileInputStream(file);
            
            while((oneByte = dis.read()) != -1) {
                if(oneByte != '\n') {
                    bArray[i] = (byte)oneByte;
                    i++;
                }
                else {
                    FileOutputStream fos = new FileOutputStream(out_file, true);
                    fos.write(bArray);
                    fos.close();
                    i = 0;
                    for(int x = 0; x < bArray.length; x++) {
                        bArray[x] = 0;
                    }
                }
            }
            
            
        } catch(Exception e) {
            System.exit(1);
        }
    }
}    